import request from '@/utils/request'

// 查询出货检验单列表
export function listOqc(query) {
  return request({
    url: '/ldzl-qc/oqc/list',
    method: 'get',
    params: query
  })
}

// 查询出货检验单详细
export function getOqc(oqcId) {
  return request({
    url: '/ldzl-qc/oqc/' + oqcId,
    method: 'get'
  })
}

// 新增出货检验单
export function addOqc(data) {
  console.log(1111111111111111111111111111111111111111111111)
  return request({
    url: '/ldzl-qc/oqc',
    method: 'post',
    data: data
  })
}

// 修改出货检验单
export function updateOqc(data) {
  return request({
    url: '/ldzl-qc/oqc',
    method: 'put',
    data: data
  })
}

// 删除出货检验单
export function delOqc(oqcId) {
  return request({
    url: '/ldzl-qc/oqc/' + oqcId,
    method: 'delete'
  })
}

// 查询出货检验单行列表
export function listQcOqcLine(data) {
  return request({
    url: '/ldzl-qc/oqc/selectQcOqcLineList',
    method: 'post',
    data: data
  })
}

// 新增出货检验单行
export function addQcOqcLine(data) {
  return request({
    url: '/ldzl-qc/oqc/addQcOqcLine',
    method: 'post',
    data: data
  })
}

// 修改出货检验单行
export function updateQcOqcLine(data) {
  return request({
    url: '/ldzl-qc/oqc/updateQcOqcLine',
    method: 'put',
    data: data
  })
}

// 删除出货检验单行
export function deleteQcOqcLine(lineIds) {
  return request({
    url: '/ldzl-qc/oqc/deleteQcOqcLineByLineIds/' + lineIds,
    method: 'delete'
  })
}

// 查询未检测出货单列表
export function selectCkProductSales(params) {
  // 处理可能的null或undefined参数，使用"%" 作为默认占位符
  const processedParams = { ...params };
  if (!processedParams.sales_code || processedParams.sales_code === '') {
    processedParams.sales_code = '%';
  }
  if (!processedParams.sales_name || processedParams.sales_name === '') {
    processedParams.sales_name = '%';
  }

  return request({
    url: '/ldzl-qc/oqc/outbound/selectCkProductSales',
    method: 'get',
    params: processedParams
  })
}
